
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Utils;

public class BossPanel : MonoBehaviour
{
    public Monster monster;
    private Slider hpSlider;
    private TextMeshProUGUI hpText;

    private void Awake()
    {
        hpSlider = UITool.GetComponent<Slider>("HP", gameObject);
        hpText = UITool.GetComponent<TextMeshProUGUI>("HPText", hpSlider.gameObject);
    }


    // Start is called before the first frame update
    void Start()
    {
        ResetAllValue();
    }

    // Update is called once per frame
    void Update()
    {
        UpdateAllValue();
    }
    
    public void UpdateAllValue()
    { 
        hpSlider.value = monster.hp;
        hpText.text = hpSlider.value + " / " + hpSlider.maxValue;

    }
    
    private void ResetAllValue()
    { 
        hpSlider.value = monster.hp;
        hpSlider.maxValue = monster.hp;

        hpText.text = hpSlider.value + " / " + hpSlider.maxValue;
    }
}
